import mmcv
import os
import numpy as np
from mmcv.runner import load_checkpoint
from mmdet.models import build_detector
from mmdet.apis import init_detector, inference_detector


config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
checkpoint_file = 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'

model = init_detector(config_file,checkpoint_file)

img = 'demo/01.jpg'
result = inference_detector(model,img)
model.show_result(img, result, out_file='01.jpg')

img = 'demo/02.jpg'
result = inference_detector(model,img)
model.show_result(img, result, out_file='02.jpg')

img = 'demo/03.jpg'
result = inference_detector(model,img)
model.show_result(img, result, out_file='03.jpg')
